package useful;

public class Pair<A extends Comparable<A>,B> implements Comparable<Pair<A,B>> {
    A a;
    B b;
    
    public Pair(A a, B b) {
        this.a = a;
        this.b = b;
    }
    
    public A first() {
        return a;
    }
    
    public B second() {
        return b;
    }
    
    @Override
    public String toString() {
        return "(" + a + "," + b + ")";
    }

	@Override
	public int compareTo(Pair<A, B> o) {
		if (o == null)
			return -1;
		return a.compareTo(o.first());
	}
}
